package model.utils;

/**
 * Class representing the movement speed for the objects(enemies).
 * 
 * @author EvilTeam
 * 
 */
public class Speed {

	public static final int DIRECTION_DOWN = 0;
	public static final int DIRECTION_LEFT = 1;
	public static final int DIRECTION_RIGHT = 2;
	public static final int DIRECTION_UP = 3;

	private float xVelocity;
	private float yVelocity;

	private int xStartDirection = 1;
	private int yStartDirection = 1;

	public Speed() {
		this.xVelocity = 1;
		this.yVelocity = 1;
	}

	public Speed(float x, float y) {
		this.setxVelocity(x);
		this.setyVelocity(y);
	}

	public float getxVelocity() {
		return xVelocity;
	}

	public void setxVelocity(float xVelocity) {
		if (xVelocity >= 0)
			this.xVelocity = xVelocity;
	}

	public float getyVelocity() {
		return yVelocity;
	}

	public void setyVelocity(float yVelocity) {
		if (yVelocity >= 0)
			this.yVelocity = yVelocity;
	}

	/**
	 * 
	 * @return current direction on the x axis. It can be positive or negative.
	 */
	public int getxStartDirection() {
		return xStartDirection;
	}

	/**
	 * Changing x axis direction from positive to negative.
	 */
	public void changeXAxisDirection() {
		this.xStartDirection *= -1;
	}

	/**
	 * 
	 * @return current direction on the x axis. It can be positive or negative.
	 */
	public int getyStartDirection() {
		return yStartDirection;
	}

	/**
	 * Changing y axis direction from positive to negative.
	 */
	public void changeYAxisDirection() {
		this.yStartDirection *= -1;
	}

	/**
	 * Resets x and y axis directions to positive.
	 */
	public void resetXYAxisDirections() {
		this.yStartDirection = 1;
		this.xStartDirection = 1;
	}
}
